app.factory('DaoService', function($http, ConfigMap) {

		
	return {
		http: function (url, params, callback) {
		    var isDev = ConfigMap.dev;
			
			var httpObj = {
		        method: 'JSONP',
		        url: url+'?callback=jsonpCallback',
		        params:params
			};

			if(ConfigMap.dev){
				httpObj.url 	= '/mock/'+httpObj.url;
				httpObj.method  = 'GET';
				 $http(httpObj).then(function success(data) {
                    if (callback) {
                        callback(data.data);
                    }
                }, function error(data) {
                    alert('服务器累趴下了');
                    writeObj(data);
                });
			}else{
				httpObj.url = ConfigMap.hostUrl + httpObj.url;
				$http(httpObj);
			}
			jsonpCallback = function(data){
				if(callback){
					callback(data);
				}
			};
		}
	};
});
